<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Enabling SSL for the Server</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with Distributed Berkeley DB Applications" />
    <link rel="up" href="server.html" title="Chapter 2. Berkeley DB Server" />
    <link rel="prev" href="server.stop.html" title="Stopping the server" />
    <link rel="next" href="config.html" title="Configuring the Server" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Enabling SSL for the Server</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="server.stop.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 2. Berkeley DB Server</th>
          <td width="20%" align="right"> <a accesskey="n" href="config.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="server.ssl"></a>Enabling SSL for the Server</h2>
          </div>
        </div>
      </div>
      <p> 
            To enable SSL for a server, you need to setup the appropriate
            Java key store and/or trust store files and then configure the server to
            use these key stores. 
        </p>
      <p>
            If you want to authenticate the server so that clients know that
            they are connecting to the correct server, a key store with the
            server's private key must be setup on the server. For example, the
            following command creates a key store
            <span class="emphasis"><em>keystore.jks</em></span> containing a generated
            private/public key pair.
        </p>
      <pre class="programlisting">keytool -genkeypair -alias certificatekey -keyalg RSA \
-validity 7 -keystore keystore.jks</pre>
      <p>
            If you want to authenticate clients, a trust store with trusted
            clients' public keys must be setup on the server. For more information,
            see	<a class="xref" href="client.connectssl.html" title="Connecting to a Server with SSL">Connecting to a Server with SSL</a>.		
        </p>
      <p> 
            Once the key store and/or trust store are setup, you should list
            them in the server configuration file. For example: 
        </p>
      <pre class="programlisting">ssl.host=localhost

# Configure the key store for SSL.

ssl.keyStore=keystore.jks
ssl.keyStore.password=&lt;password&gt;

# Configure the trust store for SSL.

#ssl.trustStore=truststore.jks
#ssl.trustStore.password=&lt;password&gt;</pre>
      <p> 
            For more information on the server configuration file, see <a class="xref" href="config.html#properties" title="Server Configuration File">Server Configuration File</a>.
        </p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="server.stop.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="server.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="config.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Stopping the server </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Configuring the Server</td>
        </tr>
      </table>
    </div>
  </body>
</html>
